<?php
/**
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; version 3 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
*/

/**
 * Store and respresente MySQLi connection.
 * @package Core
 * @subpackage Database
 * @author kovacsricsi
 */
class MySQLiConnection
{
	/**
	 * MySQL connection resource.
	 * @access protected
	 * @var mysqli
	 */
	protected $_connection;

	/**
	 * Constructor store connection.
	 * @access public
	 * @param mysqli $connecion
	 * @return void
	 */
	public function __construct(mysqli $connecion)
	{
		$this->_connection = $connecion;
	}

	/**
	 * Destructor close connection.
	 * @access public
	 * @return void
	 */
	public function __destruct()
	{
		if (!is_null($this->_connection->get_server_info())) {
			$this->_connection->close();
		}
	}

	/**
	 * Returns with resource.
	 * @access public
	 * @return mysqli
	 */
	public function getConnection()
	{
		return $this->_connection;
	}
}

?>
